<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{$site.title} - {:lang('Member center')} - {:lang('Profile')}</title>

    {include file="user/common/head"}
</head>
<body class="main-body">
{include file="user/common/menu"}

<div class="container">
    <div class="row">
        <div class="col-md-3">
            {include file="user/common/nav"}
        </div>
        <div class="col-md-9">
            <div class="card user-card">
                <div class="card-header">
                    <h4 class="card-title">{:lang('Profile')}</h4>
                </div>
                <div class="card-body">
                    <form class="frm-operate" method="post" action="">
                        <div class="form-group row">
                            <label for="frm-username" class="col-sm-2 col-form-label">{:lang('Username')}: </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="frm-username" name="row[username]" placeholder="" value="{$profile.username}" data-rule="required" disabled>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="frm-nickname" class="col-sm-2 col-form-label">{:lang('Nickname')}: </label>
                            <div class="col-sm-8">
                                <input type="text" class="form-control" id="frm-nickname" name="row[nickname]" placeholder="" value="{$profile.nickname}" data-rule="required">
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="frm-avatar" class="col-sm-2 col-12 col-form-label">{:lang('Avatar')}：</label>
                            <div class="col-sm-8 col-12 fileGroup">
                                <div class="file-btn">
                                    <input type="text" class="form-control txt-files" id="frm-avatar" name="row[avatar]" placeholder="" value="{$profile.avatar}">
                                    <input type="button" value="{:lang('Upload avatar')}" class="btn btn-default ml-1 btn-imgUpload btn-sm" data-multiple="false" data-url="{:url('/user.user/upload')}" data-field="frm-avatar">
                                </div>
                                <div class="file-preview row mt-2"></div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="frm-sex" class="col-sm-2 col-form-label">{:lang('Gender')}: </label>
                            <div class="col-sm-8">
                                <select name="row[gender]" id="frm-sex" class="form-control">
                                    <option value="0" {if $profile.gender==0}selected{/if}>{:lang('Secrecy')}</option>
                                    <option value="1" {if $profile.gender==1}selected{/if}>{:lang('Man')}</option>
                                    <option value="2" {if $profile.gender==2}selected{/if}>{:lang('Girl')}</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="frm-introduction" class="col-sm-2 col-form-label">{:lang('Introduction')}: </label>
                            <div class="col-sm-8">
                                <textarea rows="3" name="row[introduction]" id="frm-introduction" class="form-control">{$profile.introduction}</textarea>
                            </div>
                        </div>
                        <div class="row">
                            <div class="col-sm-2"></div>
                            <div class="col-sm-8">
                                <button type="submit" class="btn btn-primary btn-submit">{:lang('Save')}</button>
                                <button type="reset" class="btn btn-default">{:lang('Reset')}</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

{include file="user/common/footer"}
<script>
    require(['jquery','bootstrap','layer','Form'], function ($,undefined,layer,Form) {
        Form.api.init({success:function (data, response) {
                Layer.msg(response.msg,{time:1000, icon:1},function (e) {
                    window.location.reload();
                });
                return false;
            }});
    })
</script>

</body>
</html>